# Contributor: Justin Berthault <justin.berthault@zaclys.net>
# Maintainer: Justin Berthault <justin.berthault@zaclys.net>
pkgname=writefreely
pkgver=0.12.0
pkgrel=0
pkgdesc="Federated blogging from write.as"
url="https://writefreely.org"
arch="all !mips !mips64" # missing dependencies
license="AGPL-3.0-or-later"
pkgusers="$pkgname"
pkggroups="$pkgname"
makedepends="go go-bindata sqlite-dev nodejs-less nodejs-less-plugin-clean-css"
install="$pkgname.pre-install"
source="$pkgname-$pkgver.tar.gz::https://github.com/writeas/writefreely/archive/v$pkgver.tar.gz
	config.ini"
options="!check"

build() {
	make ui
	make build
}

check() {
	make test
}

package() {
	install -d -o $pkgname -g $pkgname "$pkgdir"/var/lib/$pkgname
	install -d -o $pkgname -g $pkgname "$pkgdir"/var/lib/$pkgname/keys
	install -d -o $pkgname -g $pkgname "$pkgdir"/var/lib/$pkgname/data

	install -dm755 "$pkgdir"/usr/share/$pkgname/pages
	install -dm755 "$pkgdir"/usr/share/$pkgname/static
	install -dm755 "$pkgdir"/usr/share/$pkgname/templates

	install -Dm644 "$srcdir"/config.ini "$pkgdir"/etc/writefreely/config.ini

	install -Dm755 "$builddir"/cmd/$pkgname/$pkgname "$pkgdir"/usr/bin/$pkgname
	cp -r "$builddir"/pages/* "$pkgdir"/usr/share/writefreely/pages
	cp -r "$builddir"/static/* "$pkgdir"/usr/share/writefreely/static
	cp -r "$builddir"/templates/* "$pkgdir"/usr/share/writefreely/templates
}

sha512sums="b6db31bcc84fe69cda69cb595a5a52b55981855819c18b7a729fda6400be02780e76f758c1811b3b079a6c410454e663233a2f5be2f24d3f27d90f143453a0b8  writefreely-0.12.0.tar.gz
27685562af68e5c03850cf346e95f87657dfceffc396441ca3315ca2065ccd4ea86dbd831b0c3f1dce99de4a6317eaf495ce979d5e98c3feeebbd0fbc793fa30  config.ini"
